$.ajaxSetup({
    headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
});
//获取值

$("#leavemessage").click(function () {
    var name=$("#name").val();
    var phone = $("#phone").val();
    var internet = $("#internet").val();
    var email = $("#email").val();
    var message = $('#message').val();
    if (name != '' && phone !='' && internet !='' && email !='' && message !='')
    {
        $.ajax({
            type: 'POST',
            url: '/dorequest',
            data: {name: name, phone: phone,internet:internet,email:email,message:message},
            success: function (res) {
                if (res.code==200)
                {
                    alert("感谢您的留言我们会倾听你的贵言!")
                    window.location.href = '/request.html';
                }
            },
            datatype:'json'
        });
    }
    else
    {
        alert("不能为空")
    }
})